home *** CD-ROM | disk | FTP | other *** search
- ATARI MACHINE SPECIFIC LIBRARY
-
-
-
- NAME
- MobileSprite - a derived Sprite that moves by itself
-
- SYNOPSIS
- #include <MobileSprite.h>
-
- class MobileSprite : public Sprite
- enum BoundaryEffect
- const ...
-
- DESCRIPTION
- Many times a sprite is used, it is moved about the screen at
- certain speeds, and bounded in a rectangle. This module provides
- such a sprite.
-
- CLASSES
- A MobileSprite is just like a normal Sprite, but it can be set in
- motion and moved with a simple Move() member call.
-
- CONSTANTS
- The following constants are used for specifying boundary edges:
- HitNorth, HitSouth, HitEast, HitWest.
-
- TYPES
- enum BoundaryEffect
- Used to define the effect caused by a MobileSprite interracting
- with its boundary.
- Bounce - Reverse the x or y speed component as necessary,
- possibly slowing down in the process according to
- the Bounciness (See AtBoundary below).
- Wrap - Move to the othe side of the range and continue with
- the same speed.
- Stop - Stop at the boundary.
- The x and y components stop separately.
- Watch - Do nothing - it is then up to the programmer to use
- the return value from the member Move() to decide
- what to do.
-
- CLASS MEMBERS
- MobileSprite::
- MobileSprite(Incarnation **Them,int Count)
- MobileSprite(Incarnation *OnlyOne)
- MobileSprite(short maxinca)
- MobileSprite(const char *filename)
- As per Sprite:: constructors.
-
- void Accelerate(int x, int y)
- Speed up by the given x and y amounts.
-
- bool Stationary()
- TRUE if the sprite is not moving.
-
- void Speed(int x, int y)
- void XSpeed(int)
- void YSpeed(int)
- int XSpeed()
- int YSpeed()
- Set/inspect the x and y component speeds.
-
- void Range(int minX, int minY, int maxX, int maxY)
- Set the area in which the sprite may move.
-
- short Move()
- Move the sprite. The value returned specifies any edges it
- interacted with. (See enum BoundaryEffect)
-
- void Unmove()
- Undo the previous move. Usually used in response to a boundary
- interraction.
-
- void Rebound(short Walls)
- Undo and rebound against given walls
-
- void Frictate(short fric)
- Slow down by fric 256ths. This works best if the sprite is
- scaled highly, since that gives more bits for fractional speeds.
-
- void AtBoundary(BoundaryEffect, short Bouncy=256)
- void AtBoundary(BoundaryEffect North, BoundaryEffect South,
- BoundaryEffect East, BoundaryEffect West, short Bouncy=256)
- Define the behaviour required when a sprite interracts with the
- boundary of its Range.
-
- SEE ALSO
- Sprite
-
- AUTHOR
- Warwick Allison, 1992.
- warwick@cs.uq.oz.au
-
- COPYING
- This functionality is part of the Atari Machine Specific Library,
- and is Copyright 1992 by Warwick W. Allison.
-
- The Atari Machine Specific Library is free and protected under the
- GNU Library General Public License.
-
- You are free to copy and modify these sources, provided you acknowledge
- the origin by retaining this notice, and adhere to the conditions
- described in the GNU LGPL.
-